<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>



    <script>
        var count = 0;
        for (i = 1; i <= 3; i++) {
            var sum = 0;
            for (j = 1; j <= 4; j++) {
                var score = prompt('请输入第'+i+'班第'+j+'的学生成绩：')*1;
                sum=sum+score;
                count++;
                if(count%4==0){
                    document.write('<br>');
                }
            }
            document.write('第'+i+'班成绩：'+sum);
        }
    </script>
</body>

</html>